近期動態是利用Coursera學習Machine Learning,在上週結束台灣人工智慧學校的申請及複試後,將前幾週的進度補齊,就先用我上週的學習筆記來做為開賽第一篇。
Classification problem can use Logistic function(Sigmold function) to solve. The value of Y is discrete, only shows 0 and 1. For example, whether is E-mail spam or not, we could create a classifier to seperate.
predict "y = 1" if h(x) >= 0.5
predict "y = 0" if h(x) < 0.5
We change the hypothsis to h(x) = g(z) = 1/(1+e^(-z)), z = transpose(theta)×x, to avoid the problem like h(x) > 1 or h(x) < 0, and add some larger x.
Decision boundary
Ex: predict "y = 1" if -1 + x1^2 + x2^2 >= 0, the the boundary is -1 + x1^2 + x2^2 = 0
Cost Function
J(theta) = (1/m)sum(cost(h(x), y), cost(h(x), y) = (-y)log(h(x)) - (1-y)log(1-h(x))
Vectorized implementation
h = g(X×theta), J(theta) = (1/m)×(transpose(-y)log(h) - transpose(1-y)log(1-h))
今天先試試看部分筆記,課程編碼是使用Octave,之後在po作業的程式碼上來。